import request from "@/utils/request";

//注册
export function register(registerInfo){
  return request({
    //url:'/user/register',
    url:'/employee/register',
    method:'post',
    params:{
      username:registerInfo.userName,
      password:registerInfo.passWord
    }
  })
}

//登录
export function login(loginInfo) {
  return request({
    url: "/user/login",
    method: "post",
    params:{loginInfo}
  });
}

//获取用户信息
export function getUserInfo(token) {
  return request({
    url: "/user/getUserInfo",
    method: "get",
    params: { token }
  });
}

//获取验证码
export function getValidateCode(){
  return request({
    //url:'/user/getValidateCode',
    url:"/employee/verifyCode",
    method:'post'
  })
}

//找回密码
export function retrievePwd(phone,validateCode){
  return request({
    url:'/user/retrievePwd',
    method:'post',
    params:{
      phone:{phone},
      validateCode:{validateCode}
    }
  })
}

//设置新密码
export function setNewPwd(phone,newPwd){
  return request({
    url:'/user/setNewPwd',
    method:'post',
    params:{
      phone:{phone},
      newPwd:{newPwd}
    }
  })
}

//注销
export function logout(userId) {
  return request({
    url: "/user/logout",
    method: "post",
    params:{userId}
  });
}
